<template>
  <div>
    <div v-for="menu in menus" :key="menu.path">
      <el-submenu v-if="menu.children && menu.children.length>0" :index="menu.path">
        <template slot="title">
           <i :class="menu.meta.icon"></i>
          <span>{{menu.meta.title}}</span>
        </template>
        <!-- 嵌套使用组件 -->
        <NavbarItem :menus="menu.children"></NavbarItem>
        <!-- <div v-for="child in menu.children" :key="child.path">
              <el-submenu v-if="child.children && child.children.length>0" :index="child.path">
                <template slot="title">
                  <i class="el-icon-location"></i>
                  <span>{{child.title}}</span>
                </template>
              </el-submenu>
              <el-menu-item v-else :index="child.path">
                <i class="el-icon-menu"></i>
                <span slot="title">{{child.title}}</span>
              </el-menu-item>
        </div>-->
      </el-submenu>
      <el-menu-item v-else :index="menu.path">
         <i :class="menu.meta.icon"></i>
        <span slot="title">{{menu.meta.title}}</span>
      </el-menu-item>
    </div>
  </div>
</template>

<script>
export default {
  name: "NavbarItem",
  props: {
    menus: {
      type: Array,
      require: true
    }
  }
};
</script>

<style >
.el-menu--collapse .el-submenu__title span
{
  display: none;
  
}
i.el-submenu__icon-arrow.el-icon-arrow-right
{
  display: none;
}


.el-menu--collapse{
  width: 12vh !important;
}
</style>